package com.bjsxt.userscenter.users.pojo;

import java.io.Serializable;
import java.util.Date;

/**
 * 管理员表的POJO
 * 
 * @author WangshSxt
 */
public class AAdmins implements Serializable
{
	private int id;
	private int roleId;
	private String email;
	private String password;
	private String name;
	private String phone;
	private String qq;
	private byte sex;
	private String content;
	private int faildCount ; 
	private Date faildTime ; 
	private byte status;
	private Date createTime;
	private Date updateTime;
	private Date lastLoginTime;

	/* 关联对象 */
	private ARole role;
	
	/* 字符串描述 */
	private String statusStr ; 

	public int getId()
	{
		return id;
	}

	public void setId(int id)
	{
		this.id = id;
	}

	public int getRoleId()
	{
		return roleId;
	}

	public void setRoleId(int roleId)
	{
		this.roleId = roleId;
	}

	public String getEmail()
	{
		return email;
	}

	public void setEmail(String email)
	{
		this.email = email;
	}

	public String getPassword()
	{
		return password;
	}

	public void setPassword(String password)
	{
		this.password = password;
	}

	public String getName()
	{
		return name;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public String getPhone()
	{
		return phone;
	}

	public void setPhone(String phone)
	{
		this.phone = phone;
	}

	public String getQq()
	{
		return qq;
	}

	public void setQq(String qq)
	{
		this.qq = qq;
	}

	public byte getSex()
	{
		return sex;
	}

	public void setSex(byte sex)
	{
		this.sex = sex;
	}

	public String getContent()
	{
		return content;
	}

	public void setContent(String content)
	{
		this.content = content;
	}

	public byte getStatus()
	{
		return status;
	}

	public void setStatus(byte status)
	{
		this.status = status;
	}

	public Date getCreateTime()
	{
		return createTime;
	}

	public void setCreateTime(Date createTime)
	{
		this.createTime = createTime;
	}

	public Date getUpdateTime()
	{
		return updateTime;
	}

	public void setUpdateTime(Date updateTime)
	{
		this.updateTime = updateTime;
	}

	public Date getLastLoginTime()
	{
		return lastLoginTime;
	}

	public void setLastLoginTime(Date lastLoginTime)
	{
		this.lastLoginTime = lastLoginTime;
	}

	public ARole getRole()
	{
		return role;
	}

	public void setRole(ARole role)
	{
		this.role = role;
	}

	/**
	 * 状态:0:禁用,1:启用
	 * 
	 * 根据status的值显示对应的字符串(从枚举中取值)
	 * @return
	 */
	public String getStatusStr()
	{
		/*
		 * 循环枚举
		 */
		AAdminsEnum[] adminsEnums = AAdminsEnum.values();
		for (int i = 0; i < adminsEnums.length; i++)
		{
			AAdminsEnum adminsEnum = adminsEnums[i];
			/* 一个表中有多个byte类型的字段(枚举)
			 * 不同的byte字段可以有相同的值,
			 * 所以在判断的时候,即要判断值,又要判断名称
			 *  */
			if(this.getStatus() == adminsEnum.getStatus() && adminsEnum.toString().startsWith("STATUS"))
			{
				this.statusStr = adminsEnum.getInfo() ; 
			}
			/*ConstatFinalUtil.SYS_LOGGER.info("info:{},status:{},属性名:{}",
					adminsEnum.getInfo(),adminsEnum.getStatus(),adminsEnum);*/
		}
		return statusStr;
	}

	public int getFaildCount()
	{
		return faildCount;
	}

	public void setFaildCount(int faildCount)
	{
		this.faildCount = faildCount;
	}

	public Date getFaildTime()
	{
		return faildTime;
	}

	public void setFaildTime(Date faildTime)
	{
		this.faildTime = faildTime;
	}

	public void setStatusStr(String statusStr)
	{
		this.statusStr = statusStr;
	}
}
